package com.home.duy.GUI;

import javax.swing.SwingUtilities;
import java.awt.BorderLayout;
import java.awt.GridLayout;
import java.awt.Image;

import javax.swing.BoxLayout;
import javax.swing.JInternalFrame;
import javax.swing.JPanel;
import javax.swing.JFrame;
import javax.swing.JSeparator;
import javax.swing.LookAndFeel;
import javax.swing.UIManager;
import javax.swing.UnsupportedLookAndFeelException;

import com.home.Common.Common;
import com.home.Common.Resources_Duy;
import com.home.duy.code.components.DesktopPane;
import com.home.truc.GUI.frmBanHang;

import javax.swing.JButton;
import javax.swing.JMenuBar;
import javax.swing.JMenu;
import javax.swing.JMenuItem;
import java.awt.Dimension;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.beans.PropertyVetoException;

import javax.swing.JToolBar;
import javax.swing.border.EmptyBorder;
import javax.swing.JDesktopPane;
import javax.swing.JLabel;

public class ParentFrame extends JFrame {

	private static final long serialVersionUID = 1L;
	private JPanel jContentPane = null;
	private JMenuBar mainMenuBar = null;
	private JMenu menuHeThong = null;
	private JMenuItem menuItemDangNhap = null;
	private JMenuItem menuItemDangXuat = null;
	private JMenuItem menuItemDoiMatKhau = null;
	private JMenuItem menuItemThoat = null;
	private JMenu menuThongTinQuan = null;
	private JMenuItem menuItemThongTin = null;
	private JMenuItem menuItemKhuVucBan = null;
	private JMenuItem menuItemBan = null;
	private JMenuItem menuItemThietBi = null;
	private JMenu menuNhanVien = null;
	private JMenuItem menuItemThongTinNV = null;
	private JMenuItem menuItemDKCL = null;
	private JMenuItem menuItemQLCaLam = null;
	private JMenuItem menuItemChamCong = null;
	private JMenuItem menuItemThuongPhat = null;
	private JMenuItem menuItemTinhLuong = null;
	private JMenu menuPhanQuyen = null;
	private JMenuItem menuItemThongTinTK = null;
	private JMenuItem menuItemCapQuyenTK = null;
	private JMenu menuNghiepVu = null;
	private JMenuItem menuItemBanHang = null;
	private JMenuItem menuItemTimBan = null;
	private JMenuItem menuItemChuongTrinhKM = null;
	private JMenu menuThucDon = null;
	private JMenuItem menuItemThongTinTD = null;
	private JMenuItem menuItemPhaChe = null;
	private JMenu menuNguyenVatLieu = null;
	private JMenuItem menuItemThongTinNVL = null;
	private JMenuItem menuItemKiemKho = null;
	private JMenu menuBCTK = null;
	private JMenuItem menuItemChiPhi = null;
	private JMenuItem menuItemSoLuong = null;
	private JMenuItem menuItemDoanhThu = null;
	private JMenuItem menuItemQuyTienMat = null;
	private JMenu menuTroGiup = null;
	private JToolBar toolBarIcon = null;
	private JButton btnToolBarBanHang = null;  //  @jve:decl-index=0:
	private JButton btnToolbarIconTimBan = null;
	private JToolBar toolBarBottom = null;
	private JLabel label1 = null;
	private DesktopPane desktopPane = null;
	private JButton btnTBTChamCong = null;
	private JButton btnTBTThuongPhat = null;
	private JButton btnKTBTKiemKho = null;
	/**
	 * This method initializes mainMenuBar	
	 * 	
	 * @return javax.swing.JMenuBar	
	 */
	private JMenuBar getMainMenuBar() {
		if (mainMenuBar == null) {
			mainMenuBar = new JMenuBar();
			mainMenuBar.add(getMenuHeThong());
			mainMenuBar.add(getMenuThongTinQuan());
			mainMenuBar.add(getMenuNhanVien());
			mainMenuBar.add(getMenuPhanQuyen());
			mainMenuBar.add(getMenuNghiepVu());
			mainMenuBar.add(getMenuThucDon());
			mainMenuBar.add(getMenuNguyenVatLieu());
			mainMenuBar.add(getMenuBCTK());
			mainMenuBar.add(getMenuTroGiup());
		}
		return mainMenuBar;
	}

	/**
	 * This method initializes menuHeThong	
	 * 	
	 * @return javax.swing.JMenu	
	 */
	private JMenu getMenuHeThong() {
		if (menuHeThong == null) {
			menuHeThong = new JMenu();
			menuHeThong.setIcon(Common.getImageIcon(Resources_Duy.ICON_PATH+"he_thong.png"));
			menuHeThong.setText(Resources_Duy.TITLE_MENU_HETHONG);
			menuHeThong.add(getMenuItemDangNhap());
			menuHeThong.add(getMenuItemDangXuat());
			menuHeThong.add(getMenuItemDoiMatKhau());
			menuHeThong.add(new JSeparator());
			menuHeThong.add(getMenuItemThoat());
			
		}
		return menuHeThong;
	}

	/**
	 * This method initializes menuItemDangNhap	
	 * 	
	 * @return javax.swing.JMenuItem	
	 */
	private JMenuItem getMenuItemDangNhap() {
		if (menuItemDangNhap == null) {
			menuItemDangNhap = new JMenuItem();
			menuItemDangNhap.setText(Resources_Duy.TITLE_MENU_ITEM_DANGNHAP);
			menuItemDangNhap.setIcon(Common.getImageIcon(Resources_Duy.ICON_PATH+"login.png"));
		}
		return menuItemDangNhap;
	}

	/**
	 * This method initializes menuItemDangXuat	
	 * 	
	 * @return javax.swing.JMenuItem	
	 */
	private JMenuItem getMenuItemDangXuat() {
		if (menuItemDangXuat == null) {
			menuItemDangXuat = new JMenuItem();
			menuItemDangXuat.setText(Resources_Duy.TITLE_MENU_ITEM_DANGXUAT);
			menuItemDangXuat.setIcon(Common.getImageIcon(Resources_Duy.ICON_PATH+"logout.png"));
		}
		return menuItemDangXuat;
	}

	/**
	 * This method initializes menuItemDoiMatKhau	
	 * 	
	 * @return javax.swing.JMenuItem	
	 */
	private JMenuItem getMenuItemDoiMatKhau() {
		if (menuItemDoiMatKhau == null) {
			menuItemDoiMatKhau = new JMenuItem();
			menuItemDoiMatKhau.setText(Resources_Duy.TITLE_MENU_ITEM_DOIMATKHAU);
			menuItemDoiMatKhau.setIcon(Common.getImageIcon(Resources_Duy.ICON_PATH+"change_pass.png"));
		}
		return menuItemDoiMatKhau;
	}

	/**
	 * This method initializes menuItemThoat	
	 * 	
	 * @return javax.swing.JMenuItem	
	 */
	private JMenuItem getMenuItemThoat() {
		if (menuItemThoat == null) {
			menuItemThoat = new JMenuItem();
			menuItemThoat.setText(Resources_Duy.TITLE_MENU_ITEM_THOAT);
			menuItemThoat.setIcon(Common.getImageIcon(Resources_Duy.ICON_PATH+"exit.png"));
		}
		return menuItemThoat;
	}

	/**
	 * This method initializes menuThongTinQuan	
	 * 	
	 * @return javax.swing.JMenu	
	 */
	private JMenu getMenuThongTinQuan() {
		if (menuThongTinQuan == null) {
			menuThongTinQuan = new JMenu();
			menuThongTinQuan.setIcon(Common.getImageIcon(Resources_Duy.ICON_PATH+"thong_tin_quan.png"));
			menuThongTinQuan.setText(Resources_Duy.TITLE_MENU_THONGTINQUAN);
			menuThongTinQuan.add(getMenuItemThongTin());
			menuThongTinQuan.add(getMenuItemKhuVucBan());
			menuThongTinQuan.add(getMenuItemBan());
			menuThongTinQuan.add(getMenuItemThietBi());
		}
		return menuThongTinQuan;
	}

	/**
	 * This method initializes menuItemThongTin	
	 * 	
	 * @return javax.swing.JMenuItem	
	 */
	private JMenuItem getMenuItemThongTin() {
		if (menuItemThongTin == null) {
			menuItemThongTin = new JMenuItem();
			menuItemThongTin.setText(Resources_Duy.TITLE_MENU_ITEM_THONGTIN);
			menuItemThongTin.setIcon(Common.getImageIcon(Resources_Duy.ICON_PATH+"thong_tin.png"));
			menuItemThongTin.addActionListener(new ActionListener() {
				
				@Override
				public void actionPerformed(ActionEvent arg0) {
					displayTTQ();
					
				}
			});
		}
		return menuItemThongTin;
	}

	/**
	 * This method initializes menuItemKhuVucBan	
	 * 	
	 * @return javax.swing.JMenuItem	
	 */
	private JMenuItem getMenuItemKhuVucBan() {
		if (menuItemKhuVucBan == null) {
			menuItemKhuVucBan = new JMenuItem();
			menuItemKhuVucBan.setText(Resources_Duy.TITLE_MENU_ITEM_KHUVUC);
			menuItemKhuVucBan.setIcon(Common.getImageIcon(Resources_Duy.ICON_PATH+"area.png"));
			menuItemKhuVucBan.addActionListener(new ActionListener() {
				
				@Override
				public void actionPerformed(ActionEvent arg0) {
					displayQLKV();
				}
			});
		}
		return menuItemKhuVucBan;
	}

	/**
	 * This method initializes menuItemBan	
	 * 	
	 * @return javax.swing.JMenuItem	
	 */
	private JMenuItem getMenuItemBan() {
		if (menuItemBan == null) {
			menuItemBan = new JMenuItem();
			menuItemBan.setText(Resources_Duy.TITLE_MENU_ITEM_BAN);
			menuItemBan.setIcon(Common.getImageIcon(Resources_Duy.ICON_PATH+"ban.png"));
			menuItemBan.addActionListener(new ActionListener() {
				
				@Override
				public void actionPerformed(ActionEvent arg0) {
					displayQLBan();
				}
			});
		}
		return menuItemBan;
	}

	/**
	 * This method initializes menuItemThietBi	
	 * 	
	 * @return javax.swing.JMenuItem	
	 */
	private JMenuItem getMenuItemThietBi() {
		if (menuItemThietBi == null) {
			menuItemThietBi = new JMenuItem();
			menuItemThietBi.setText(Resources_Duy.TITLE_MENU_ITEM_THIETBI);
			menuItemThietBi.setIcon(Common.getImageIcon(Resources_Duy.ICON_PATH+"device.png"));
			menuItemThietBi.addActionListener(new ActionListener() {
				
				@Override
				public void actionPerformed(ActionEvent arg0) {
					// TODO Auto-generated method stub
					displayQLThietBi();
				}
			});
		}
		return menuItemThietBi;
	}

	/**
	 * This method initializes menuNhanVien	
	 * 	
	 * @return javax.swing.JMenu	
	 */
	private JMenu getMenuNhanVien() {
		if (menuNhanVien == null) {
			menuNhanVien = new JMenu();
			menuNhanVien.setIcon(Common.getImageIcon(Resources_Duy.ICON_PATH+"nhan_vien.png"));
			menuNhanVien.setText(Resources_Duy.TITLE_MENU_NHANVIEN);
			menuNhanVien.add(getMenuItemThongTinNV());
			menuNhanVien.add(getMenuItemDKCL());
			menuNhanVien.add(getMenuItemQLCaLam());
			menuNhanVien.add(getMenuItemChamCong());
			menuNhanVien.add(getMenuItemThuongPhat());
			menuNhanVien.add(getMenuItemTinhLuong());
		}
		return menuNhanVien;
	}

	/**
	 * This method initializes menuItemThongTinNV	
	 * 	
	 * @return javax.swing.JMenuItem	
	 */
	private JMenuItem getMenuItemThongTinNV() {
		if (menuItemThongTinNV == null) {
			menuItemThongTinNV = new JMenuItem();
			menuItemThongTinNV.setText(Resources_Duy.TITLE_MENU_ITEM_THONGTINNV);
			menuItemThongTinNV.setIcon(Common.getImageIcon(Resources_Duy.ICON_PATH+"thong_tin_nv.png"));
			menuItemThongTinNV.addActionListener(new ActionListener() {
				
				@Override
				public void actionPerformed(ActionEvent arg0) {
					displayQLNV();
				}
			});
		}
		return menuItemThongTinNV;
	}


	/**
	 * This method initializes menuItemDKCL	
	 * 	
	 * @return javax.swing.JMenuItem	
	 */
	private JMenuItem getMenuItemDKCL() {
		if (menuItemDKCL == null) {
			menuItemDKCL = new JMenuItem();
			menuItemDKCL.setText(Resources_Duy.TITLE_MENU_ITEM_DKCL);
			menuItemDKCL.setIcon(Common.getImageIcon(Resources_Duy.ICON_PATH+"dang_ky_ca_lam.png"));
		}
		return menuItemDKCL;
	}

	/**
	 * This method initializes menuItemQLCaLam	
	 * 	
	 * @return javax.swing.JMenuItem	
	 */
	private JMenuItem getMenuItemQLCaLam() {
		if (menuItemQLCaLam == null) {
			menuItemQLCaLam = new JMenuItem();
			menuItemQLCaLam.setText(Resources_Duy.TITLE_MENU_ITEM_QLCALAM);
			menuItemQLCaLam.setIcon(Common.getImageIcon(Resources_Duy.ICON_PATH+"ql_ca_lam.png"));
			menuItemQLCaLam.addActionListener(new ActionListener() {
				
				@Override
				public void actionPerformed(ActionEvent arg0) {
					displayDKCL();
				}
			});
		}
		return menuItemQLCaLam;
	}

	/**
	 * This method initializes menuItemChamCong	
	 * 	
	 * @return javax.swing.JMenuItem	
	 */
	private JMenuItem getMenuItemChamCong() {
		if (menuItemChamCong == null) {
			menuItemChamCong = new JMenuItem();
			menuItemChamCong.setText(Resources_Duy.TITLE_MENU_ITEM_CHAMCONG);
			menuItemChamCong.setIcon(Common.getImageIcon(Resources_Duy.ICON_PATH+"cham_cong_20x20.png"));
		}
		return menuItemChamCong;
	}

	/**
	 * This method initializes menuItemThuongPhat	
	 * 	
	 * @return javax.swing.JMenuItem	
	 */
	private JMenuItem getMenuItemThuongPhat() {
		if (menuItemThuongPhat == null) {
			menuItemThuongPhat = new JMenuItem();
			menuItemThuongPhat.setText(Resources_Duy.TITLE_MENU_ITEM_THUONGPHAT);
			menuItemThuongPhat.setIcon(Common.getImageIcon(Resources_Duy.ICON_PATH+"thuong_phat_20x20.png"));
		}
		return menuItemThuongPhat;
	}

	/**
	 * This method initializes menuItemTinhLuong	
	 * 	
	 * @return javax.swing.JMenuItem	
	 */
	private JMenuItem getMenuItemTinhLuong() {
		if (menuItemTinhLuong == null) {
			menuItemTinhLuong = new JMenuItem();
			menuItemTinhLuong.setText(Resources_Duy.TITLE_MENU_ITEM_TINHLUONG);
			menuItemTinhLuong.setIcon(Common.getImageIcon(Resources_Duy.ICON_PATH+"tinh_luong.png"));
		}
		return menuItemTinhLuong;
	}

	/**
	 * This method initializes menuPhanQuyen	
	 * 	
	 * @return javax.swing.JMenu	
	 */
	private JMenu getMenuPhanQuyen() {
		if (menuPhanQuyen == null) {
			menuPhanQuyen = new JMenu();
			menuPhanQuyen.setText(Resources_Duy.TITLE_MENU_PHANQUYEN);
			menuPhanQuyen.add(getMenuItemThongTinTK());
			menuPhanQuyen.add(getMenuItemCapQuyenTK());
			
		}
		return menuPhanQuyen;
	}

	/**
	 * This method initializes menuItemThongTinTK	
	 * 	
	 * @return javax.swing.JMenuItem	
	 */
	private JMenuItem getMenuItemThongTinTK() {
		if (menuItemThongTinTK == null) {
			menuItemThongTinTK = new JMenuItem();
			menuItemThongTinTK.setText(Resources_Duy.TITLE_MENU_ITEM_THONGTINTK);
			menuItemThongTinTK.addActionListener(new ActionListener() {
				
				@Override
				public void actionPerformed(ActionEvent arg0) {
					displayTTTK();
				}
			});
		}
		return menuItemThongTinTK;
	}

	/**
	 * This method initializes menuItemCapQuyenTK	
	 * 	
	 * @return javax.swing.JMenuItem	
	 */
	private JMenuItem getMenuItemCapQuyenTK() {
		if (menuItemCapQuyenTK == null) {
			menuItemCapQuyenTK = new JMenuItem();
			menuItemCapQuyenTK.setText(Resources_Duy.TITLE_MENU_ITEM_CAPQUYENTK);
			menuItemCapQuyenTK.addActionListener(new ActionListener() {
				
				@Override
				public void actionPerformed(ActionEvent arg0) {
					displayCapQuyenTK();
				}
			});
		}
		return menuItemCapQuyenTK;
	}

	/**
	 * This method initializes menuNghiepVu	
	 * 	
	 * @return javax.swing.JMenu	
	 */
	private JMenu getMenuNghiepVu() {
		if (menuNghiepVu == null) {
			menuNghiepVu = new JMenu();
			menuNghiepVu.setText(Resources_Duy.TITLE_MENU_NGHIEPVU);
			menuNghiepVu.add(getMenuItemBanHang());
			menuNghiepVu.add(getMenuItemTimBan());
			menuNghiepVu.add(getMenuItemChuongTrinhKM());
		}
		return menuNghiepVu;
	}

	/**
	 * This method initializes menuItemBanHang	
	 * 	
	 * @return javax.swing.JMenuItem	
	 */
	private JMenuItem getMenuItemBanHang() {
		if (menuItemBanHang == null) {
			menuItemBanHang = new JMenuItem();
			menuItemBanHang.setText(Resources_Duy.TITLE_MENU_ITEM_BANHANG);
			menuItemBanHang.addActionListener(new ActionListener() {
				
				@Override
				public void actionPerformed(ActionEvent arg0) {
					displayBanHang();
				}
			});
		}
		return menuItemBanHang;
	}

	/**
	 * This method initializes menuItemTimBan	
	 * 	
	 * @return javax.swing.JMenuItem	
	 */
	private JMenuItem getMenuItemTimBan() {
		if (menuItemTimBan == null) {
			menuItemTimBan = new JMenuItem();
			menuItemTimBan.setText(Resources_Duy.TITLE_MENU_ITEM_TIMBAN);
		}
		return menuItemTimBan;
	}

	/**
	 * This method initializes menuItemChuongTrinhKM	
	 * 	
	 * @return javax.swing.JMenuItem	
	 */
	private JMenuItem getMenuItemChuongTrinhKM() {
		if (menuItemChuongTrinhKM == null) {
			menuItemChuongTrinhKM = new JMenuItem();
			menuItemChuongTrinhKM.setText(Resources_Duy.TITLE_MENU_ITEM_CHUONGTRINHKM);
		}
		return menuItemChuongTrinhKM;
	}

	/**
	 * This method initializes menuThucDon	
	 * 	
	 * @return javax.swing.JMenu	
	 */
	private JMenu getMenuThucDon() {
		if (menuThucDon == null) {
			menuThucDon = new JMenu();
			menuThucDon.setText(Resources_Duy.TITLE_MENU_THUCDON);
			menuThucDon.add(getMenuItemThongTinTD());
			menuThucDon.add(getMenuItemPhaChe());
			
		}
		return menuThucDon;
	}

	/**
	 * This method initializes menuItemThongTinTD	
	 * 	
	 * @return javax.swing.JMenuItem	
	 */
	private JMenuItem getMenuItemThongTinTD() {
		if (menuItemThongTinTD == null) {
			menuItemThongTinTD = new JMenuItem();
			menuItemThongTinTD.setText(Resources_Duy.TITLE_MENU_ITEM_THONGTINTD);
		}
		return menuItemThongTinTD;
	}

	/**
	 * This method initializes menuItemPhaChe	
	 * 	
	 * @return javax.swing.JMenuItem	
	 */
	private JMenuItem getMenuItemPhaChe() {
		if (menuItemPhaChe == null) {
			menuItemPhaChe = new JMenuItem();
			menuItemPhaChe.setText(Resources_Duy.TITLE_MENU_ITEM_PHACHE);
		}
		return menuItemPhaChe;
	}

	/**
	 * This method initializes menuNguyenVatLieu	
	 * 	
	 * @return javax.swing.JMenu	
	 */
	private JMenu getMenuNguyenVatLieu() {
		if (menuNguyenVatLieu == null) {
			menuNguyenVatLieu = new JMenu();
			menuNguyenVatLieu.setText(Resources_Duy.TITLE_MENU_NGUYENVL);
			menuNguyenVatLieu.add(getMenuItemThongTinNVL());
			menuNguyenVatLieu.add(getMenuItemKiemKho());
		}
		return menuNguyenVatLieu;
	}

	/**
	 * This method initializes menuItemThongTinNVL	
	 * 	
	 * @return javax.swing.JMenuItem	
	 */
	private JMenuItem getMenuItemThongTinNVL() {
		if (menuItemThongTinNVL == null) {
			menuItemThongTinNVL = new JMenuItem();
			menuItemThongTinNVL.setText(Resources_Duy.TITLE_MENU_ITEM_THONGTINNVL);
		}
		return menuItemThongTinNVL;
	}

	/**
	 * This method initializes menuItemKiemKho	
	 * 	
	 * @return javax.swing.JMenuItem	
	 */
	private JMenuItem getMenuItemKiemKho() {
		if (menuItemKiemKho == null) {
			menuItemKiemKho = new JMenuItem();
			menuItemKiemKho.setText(Resources_Duy.TITLE_MENU_ITEM_KIEMKHO);
		}
		return menuItemKiemKho;
	}

	/**
	 * This method initializes menuBCTK	
	 * 	
	 * @return javax.swing.JMenu	
	 */
	private JMenu getMenuBCTK() {
		if (menuBCTK == null) {
			menuBCTK = new JMenu();
			menuBCTK.setText(Resources_Duy.TITLE_MENU_BAOCAOTHONGKE);
			menuBCTK.add(getMenuItemChiPhi());
			menuBCTK.add(getMenuItemSoLuong());
			menuBCTK.add(getMenuItemDoanhThu());
			menuBCTK.add(getMenuItemQuyTienMat());
		}
		return menuBCTK;
	}

	/**
	 * This method initializes menuItemChiPhi	
	 * 	
	 * @return javax.swing.JMenuItem	
	 */
	private JMenuItem getMenuItemChiPhi() {
		if (menuItemChiPhi == null) {
			menuItemChiPhi = new JMenuItem();
			menuItemChiPhi.setText(Resources_Duy.TITLE_MENU_ITEM_CHIPHI);
		}
		return menuItemChiPhi;
	}

	/**
	 * This method initializes menuItemSoLuong	
	 * 	
	 * @return javax.swing.JMenuItem	
	 */
	private JMenuItem getMenuItemSoLuong() {
		if (menuItemSoLuong == null) {
			menuItemSoLuong = new JMenuItem();
			menuItemSoLuong.setText(Resources_Duy.TITLE_MENU_ITEM_SOLUONG);
		}
		return menuItemSoLuong;
	}

	/**
	 * This method initializes menuItemDoanhThu	
	 * 	
	 * @return javax.swing.JMenuItem	
	 */
	private JMenuItem getMenuItemDoanhThu() {
		if (menuItemDoanhThu == null) {
			menuItemDoanhThu = new JMenuItem();
			menuItemDoanhThu.setText(Resources_Duy.TITLE_MENU_ITEM_DOANHTHU);
		}
		return menuItemDoanhThu;
	}

	/**
	 * This method initializes menuItemQuyTienMat	
	 * 	
	 * @return javax.swing.JMenuItem	
	 */
	private JMenuItem getMenuItemQuyTienMat() {
		if (menuItemQuyTienMat == null) {
			menuItemQuyTienMat = new JMenuItem();
			menuItemQuyTienMat.setText(Resources_Duy.TITLE_MENU_ITEM_QUYTIENMAT);
		}
		return menuItemQuyTienMat;
	}

	/**
	 * This method initializes menuTroGiup	
	 * 	
	 * @return javax.swing.JMenu	
	 */
	private JMenu getMenuTroGiup() {
		if (menuTroGiup == null) {
			menuTroGiup = new JMenu();
			menuTroGiup.setText(Resources_Duy.TITLE_MENU_TROGIUP);
		}
		return menuTroGiup;
	}

	/**
	 * This method initializes toolBarIcon	
	 * 	
	 * @return javax.swing.JToolBar	
	 */
	private JToolBar getToolBarIcon() {
		if (toolBarIcon == null) {
			toolBarIcon = new JToolBar();
			toolBarIcon.add(getBtnToolBarBanHang());
			toolBarIcon.add(getBtnToolbarIconTimBan());
			toolBarIcon.add(getBtnTBTChamCong());
			toolBarIcon.add(getBtnTBTThuongPhat());
			toolBarIcon.add(getBtnKTBTKiemKho());
		}
		return toolBarIcon;
	}

	/**
	 * This method initializes btnToolBarBanHang	
	 * 	
	 * @return javax.swing.JButton	
	 */
	private JButton getBtnToolBarBanHang() {
		if (btnToolBarBanHang == null) {
			btnToolBarBanHang = new JButton();
			btnToolBarBanHang.setBorder(null);
			btnToolBarBanHang.setToolTipText(Resources_Duy.TITLE_MENU_ITEM_BANHANG);
			btnToolBarBanHang.setIcon(Common.getImageIcon(Resources_Duy.ICON_PATH+"ban_hang.png"));
		}
		return btnToolBarBanHang;
	}

	/**
	 * This method initializes btnToolbarIconTimBan	
	 * 	
	 * @return javax.swing.JButton	
	 */
	private JButton getBtnToolbarIconTimBan() {
		if (btnToolbarIconTimBan == null) {
			btnToolbarIconTimBan = new JButton();
			btnToolbarIconTimBan.setToolTipText(Resources_Duy.TITLE_MENU_ITEM_TIMBAN);
			btnToolbarIconTimBan.setIcon(Common.getImageIcon(Resources_Duy.ICON_PATH+"tim_ban.png"));
		}
		return btnToolbarIconTimBan;
	}

	/**
	 * This method initializes toolBarBottom	
	 * 	
	 * @return javax.swing.JToolBar	
	 */
	private JToolBar getToolBarBottom() {
		if (toolBarBottom == null) {
			label1 = new JLabel();
			label1.setText("Quan Ly Cua So");
			toolBarBottom = new JToolBar();
			toolBarBottom.add(label1);
		}
		return toolBarBottom;
	}

	/**
	 * This method initializes desktopPane	
	 * 	
	 * @return javax.swing.JDesktopPane	
	 */
	private JDesktopPane getDesktopPane() {
		if (desktopPane == null) {
			//desktopPane = new DesktopPane(Resources_Duy.IMAGE_PATH+"background_coffee.jpeg");
			desktopPane = new DesktopPane("");
		}
		return desktopPane;
	}

	/**
	 * This method initializes btnTBTChamCong	
	 * 	
	 * @return javax.swing.JButton	
	 */
	private JButton getBtnTBTChamCong() {
		if (btnTBTChamCong == null) {
			btnTBTChamCong = new JButton();
			btnTBTChamCong.setToolTipText(Resources_Duy.TITLE_MENU_ITEM_CHAMCONG);
			btnTBTChamCong.setIcon(Common.getImageIcon(Resources_Duy.ICON_PATH+"cham_cong.png"));
		}
		return btnTBTChamCong;
	}

	/**
	 * This method initializes btnTBTThuongPhat	
	 * 	
	 * @return javax.swing.JButton	
	 */
	private JButton getBtnTBTThuongPhat() {
		if (btnTBTThuongPhat == null) {
			btnTBTThuongPhat = new JButton();
			btnTBTThuongPhat.setToolTipText(Resources_Duy.TITLE_MENU_ITEM_THUONGPHAT);
			btnTBTThuongPhat.setIcon(Common.getImageIcon(Resources_Duy.ICON_PATH+"thuong_phat.png"));
		}
		return btnTBTThuongPhat;
	}

	/**
	 * This method initializes btnKTBTKiemKho	
	 * 	
	 * @return javax.swing.JButton	
	 */
	private JButton getBtnKTBTKiemKho() {
		if (btnKTBTKiemKho == null) {
			btnKTBTKiemKho = new JButton();
			btnKTBTKiemKho.setToolTipText(Resources_Duy.TITLE_MENU_ITEM_KIEMKHO);
			btnKTBTKiemKho.setIcon(Common.getImageIcon(Resources_Duy.ICON_PATH+"kiem_kho.png"));
		}
		return btnKTBTKiemKho;
	}

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		SwingUtilities.invokeLater(new Runnable() {
			public void run() {
				ParentFrame thisClass = new ParentFrame();
				thisClass.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
				thisClass.setVisible(true);
			}
		});
	}

	/**
	 * This is the default constructor
	 */
	public ParentFrame() {
		super();
		initialize();
		this.setExtendedState(MAXIMIZED_BOTH);
	}

	/**
	 * This method initializes this
	 * 
	 * @return void
	 */
	private void initialize() {
		this.setSize(new Dimension(Common.getWidth(), Common.getHeight()));
		this.setJMenuBar(getMainMenuBar());
		this.setContentPane(getJContentPane());
		this.setTitle("COF KEPPER");
		changeLnFToWindow();
	}

	// =================== PROCESS METHOD ======================
	
	private void displayDKCL()
	{
		QuanLyCaLam qlcl = new QuanLyCaLam();
		addNewInternalFrame(qlcl);
	}
	
	private void displayQLNV()
	{
		QuanLyNV qlnv = new QuanLyNV();
		addNewInternalFrame(qlnv);
	}
	
	private void displayQLThietBi()
	{
		QuanLyThietBi qltb = new QuanLyThietBi();
		addNewInternalFrame(qltb);
	}
	
	private void displayQLBan()
	{
		QuanLiBan qlb = new QuanLiBan();
		addNewInternalFrame(qlb);
	}
	
	private void displayQLKV()
	{
		QuanLyKhuVuc qlkv = new QuanLyKhuVuc(this);
		addNewInternalFrame(qlkv);
	}
	
	private void displayTTTK()
	{
		ThongTinTK tttk = new ThongTinTK(this);
		addNewInternalFrame(tttk);
	}
	
	private void displayCapQuyenTK()
	{
		CapQuyen cp = new CapQuyen(this);
		addNewInternalFrame(cp);
	}
	
	private void displayTTQ()
	{
		ThongTinQuan ttq = new ThongTinQuan(this);
		addNewInternalFrame(ttq);
	}
	
	private void changeLnFToWindow()
	{
		try {
			//UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel");
			UIManager.setLookAndFeel("com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel");

			//UIManager.setLookAndFeel("javax.swing.plaf.nimbus.NimbusLookAndFeel");
		} catch (ClassNotFoundException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (InstantiationException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (IllegalAccessException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (UnsupportedLookAndFeelException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		SwingUtilities.updateComponentTreeUI(this);
	}
	
	public void addNewInternalFrame(JInternalFrame frame)
	{
		if(checkWindowAvailable(frame))
		{
			desktopPane.add(frame);
			frame.setVisible(true);
		}
		else
		{
			return;
		}
	}
	
	//remove a frame
	
	public void removeAFrame(JInternalFrame frame)
	{
		for (JInternalFrame inFrame : desktopPane.getAllFrames()) {
			if (inFrame.getTitle() == frame.getTitle()) {
				desktopPane.remove(inFrame);
			}
			}
	}
	//check window has been available ?
	private boolean checkWindowAvailable(JInternalFrame window) {
		for (JInternalFrame inFrame : desktopPane.getAllFrames()) {
			if (inFrame.getTitle() == window.getTitle()) {
				return false;
			}
		}
		return true;
	}
	
	// lay width cua desktopPane
	public int getWidthDesktopPane()
	{
		return getDesktopPane().getWidth();
	}
	
	// lay height cua desktopPane
	public int getHeightDesktopPane()
	{
		return getDesktopPane().getHeight();
	}
	
	private void displayBanHang()
	{
		frmBanHang frm = new frmBanHang(this);
		addNewInternalFrame(frm);
		try {
			frm.setMaximum(true);
		} catch (PropertyVetoException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		//frm.AutoSize();
	}
	
	// =================== END PROCESS METHOD ==================
	
	
	/**
	 * This method initializes jContentPane
	 * 
	 * @return javax.swing.JPanel
	 */
	private JPanel getJContentPane() {
		if (jContentPane == null) {
			jContentPane = new JPanel();
			jContentPane.setLayout(new BorderLayout());
			jContentPane.add(getToolBarIcon(), BorderLayout.NORTH);
			jContentPane.add(getToolBarBottom(), BorderLayout.SOUTH);
			jContentPane.add(getDesktopPane(), BorderLayout.CENTER);
		}
		return jContentPane;
	}

}  //  @jve:decl-index=0:visual-constraint="10,10"
